package com.marchsoft.musicalstore.exception;

import com.marchsoft.musicalstore.util.RequestToJson;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 源
 * Date: 2019-11-17
 * Time: 11:22
 */
@ControllerAdvice
public class GlobeException {

    @ExceptionHandler(value = CumtomException.class)
    @ResponseBody
    public RequestToJson aa(HttpServletRequest request, CumtomException e){
//因为返回类型类还没写，方法暂时先不写
        return new RequestToJson(1,e.getMessage());
    }
}
